﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true"
    CodeFile="NewInternalAccounting.aspx.cs" Inherits="NewInternalAccounting" Title="Ghasam | New Internal Accounting" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="smInternalAccounting" runat="server" ScriptMode="Release">
    </asp:ScriptManager>

    <script language="javascript" type="text/javascript">
        function calculatePrice(q, u, a) {
            quantity = q.value;
            unitprice = u.value;        
            a.value = (quantity * unitprice);
        }        
    
    </script>

    <div id="divNewInternalAccounting" runat="server">
        <div>
            <h3>
                <asp:Label ID="lblTitle" runat="Server" Text="ثبت هزینه"></asp:Label>
            </h3>
        </div>
        <hr />
        <div style="margin: 30px 10px;">
            
            <div>
                تعداد ردیف ها :
                <asp:TextBox ID="txtCount" Width="40" runat="server" />
                <asp:Button ID="btnGenerateRows" Text="نمایش" runat="server" OnClick="btnGenerateRows_Click" />
            </div>
            
            <br />
            <br />
        
            <div id="divType" runat="server">
                نوع پرداختی :
                <asp:DropDownList ID="ddlInternalAccountingType" DataTextField="Description" DataValueField="Id"
                    runat="server" />
            </div>
            <br />
            <br />
            تاریخ هزینه :
            <asp:TextBox ID="txtAccountingDate" runat="server" />
            &nbsp; &nbsp; &nbsp; &nbsp;
            <br />
            <br />
            <asp:Panel ID="pnlSearch" runat="server">
                <ajax:AutoCompleteExtender ID="ace1" TargetControlID="txtSalesPerson" ServicePath="~/WebService/AutoCompleteService.asmx"
                    ServiceMethod="GetSalesPersonName" MinimumPrefixLength="2" CompletionInterval="1000"
                    EnableCaching="true" CompletionSetCount="12" runat="server" />
                نام فروشنده :
                <asp:TextBox ID="txtSalesPerson" autocomplete="off" runat="server" />
            </asp:Panel>
            <br />
            <br />
            
            تخفیف کلی :
            <asp:TextBox ID="txtDiscount" runat="server" />
            
            &nbsp; &nbsp; &nbsp; &nbsp;
            
            شماره فاکتور:
            <asp:TextBox ID="txtInvoiceNumber" runat="server" />
            
            &nbsp; &nbsp; &nbsp; &nbsp;
            نقدی:
            <asp:CheckBox ID="cbPaid" runat="server" />
            
            <br />
            <br />
            <asp:UpdatePanel ID="upItemsList" runat="server">
                <ContentTemplate>
                    <table cellpadding="5" border="2" cellspacing="1" style="border-color: Blue" width="850">
                        <tr style="background: #eaeaea; text-align: center">
                            <td>
                                نام حساب
                            </td>
                            <td>
                                نام کالا
                            </td>
                            <td>
                                مقدار
                            </td>
                            <td>
                                قیمت واحد
                            </td>
                            <td>
                                قیمت کل
                            </td>
                            <td>
                                توضیحات
                            </td>
                        </tr>
                        <asp:PlaceHolder ID="phInternalAccountingRows" EnableViewState="true" runat="server">
                        </asp:PlaceHolder>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
            <br />
            <asp:Button ID="btnSave" Text="ثبت هزینه" ValidationGroup="Accounting" runat="server"
                OnClick="btnSave_Click" />
        </div>
        <br />
        <br />
        <hr />
        <br />
        <div class="title">
            <h3>
                <asp:Label ID="lblItemTitle" runat="Server" Text="اضافه کردن کالا"></asp:Label>
            </h3>
        </div>
        <div>
            <asp:UpdatePanel ID="upItem" runat="server">
                <ContentTemplate>
                    <asp:Label ID="lblMessage" ForeColor="Red" runat="server" />
                    <br />
                    <br />
                    نام کالا :
                    <asp:TextBox ID="txtItemName" runat="server" />
                    <asp:RequiredFieldValidator ID="rfvItemName" ValidationGroup="Items" ControlToValidate="txtItemName"
                        ErrorMessage="*" runat="server" />
                    <br />
                    <br />
                    واحد کالا :
                    <asp:TextBox ID="txtItemUnit" runat="server" />
                    <asp:RequiredFieldValidator ID="rfvItemUnit" ValidationGroup="Items" ControlToValidate="txtItemUnit"
                        ErrorMessage="*" runat="server" />
                    <br />
                    <br />
                    <asp:Button ID="btnSaveItem" Text="ذخیره" ValidationGroup="Items" runat="server"
                        OnClick="btnSaveItem_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger EventName="Click" ControlID="btnSaveItem" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
        <br />
        <br />
        <hr />
        <br />
        <div class="title">
            <h3>
                <asp:Label ID="lblNewAccount" runat="Server" Text="اضافه کردن حساب"></asp:Label>
            </h3>
        </div>
        <div>
            <asp:UpdatePanel ID="upAccount" runat="server">
                <ContentTemplate>
                    <asp:Label ID="lblAccountMessage" ForeColor="Red" runat="server" />
                    <br />
                    <br />
                    نام حساب
                    <asp:TextBox ID="txtAccountName" runat="server" />
                    <asp:RequiredFieldValidator ID="rfvAccountName" ValidationGroup="Accounts" ControlToValidate="txtAccountName"
                        ErrorMessage="*" runat="server" />
                    <br />
                    <br />
                    توضیحات
                    <asp:TextBox ID="txtAccountDescription" Width="300" runat="server" />
                    <br />
                    <br />
                    <asp:Button ID="btnSaveAccount" Text="ایجاد" runat="server" ValidationGroup="Accounts"
                        OnClick="btnSaveAccount_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger EventName="Click" ControlID="btnSaveAccount" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
        <br />
        <br />
        <hr />
        <br />
        <div class="title">
            <h3>
                <asp:Label ID="lblNewSalesPerson" runat="Server" Text="اضافه کردن فروشنده"></asp:Label>
            </h3>
        </div>
        <div>
            <asp:UpdatePanel ID="upSalesPerson" runat="server">
                <ContentTemplate>
                    <asp:Label ID="lblSalesPersonMessage" ForeColor="Red" runat="server" />
                    <br />
                    <br />
                    <table>
                        <tr>
                            <td>
                                عنوان
                            </td>
                            <td>
                                <asp:TextBox ID="txtSalesPersonTitle" runat="server" />
                                <asp:RequiredFieldValidator ID="rfvName" ValidationGroup="SalesPerson" runat="server" ControlToValidate="txtSalesPersonTitle"
                                    ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                شماره تلفن
                            </td>
                            <td>
                                <asp:TextBox ID="txtSalesPersonPhoneNumber" runat="server" />
                                <asp:RequiredFieldValidator ID="rfvPhone" runat="server" ValidationGroup="SalesPerson" ControlToValidate="txtSalesPersonPhoneNumber"
                                    ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                آدرس
                            </td>
                            <td>
                                <asp:TextBox ID="txtSalesPersonAddress" runat="server" TextMode="MultiLine" Width="300"
                                    Height="60" />
                                <asp:RequiredFieldValidator ID="rfvAddress" runat="server" ValidationGroup="SalesPerson" ControlToValidate="txtSalesPersonAddress"
                                    ErrorMessage="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                    </table>
                    <div style="margin: 20px">
                        <asp:Button ID="btnSaveSalesPerson" Text="ذخیره" runat="server" ValidationGroup="SalesPerson" OnClick="btnSaveSalesPerson_Click" />
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger EventName="Click" ControlID="btnSaveSalesPerson" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </div>
</asp:Content>
